<?php
/* $Id$ */

require_once "ShockwaveFlashMovie.class.php";

class ShockwaveFlashVideo extends ShockwaveFlashMovie {

	private $actionscript_videoWithProgressBar = null;

	private $counter_videoLabels		   = 0;
	
	private $tpl_videoLabel_txt	= "video{shockwaveflashvideo_counter_videoLabels}"; 

	function ShockwaveFlashVideo() {

		/* Superklasse aufrufen */
		$this->ShockwaveFlashMovie( );

		/* ActionScripte registrieren */

		$this->registerActionScriptFile ( "VideoWithProgressBar", "lib/swf/actionscripts/VideoWithProgressBar.as.php" );

	}

	function getNextVideoLabel() {
		$this->getTemplateProcessor()->registerKeyword( 
			"{shockwaveflashvideo_counter_videoLabels}",
			$this->counter_videoLabels++
		);

		return $this->getTemplateProcessor()->processString( $this->tpl_videoLabel_txt );
	}

	function buildContentMovie( $fileName, $width, $height, $background_rgb_array, $fps ) {

		$this->getTemplateProcessor()->registerKeyword( 
			"{shockwaveflashvideo_flv_filename}",
			$fileName
		);

		$script = $this->getActionScriptByName( "VideoWithProgressBar" );
	
		$action = new SWFAction($script);
		$stream = new SWFVideoStream();
		$stream->setDimension($width,$height);

		$movie = new SWFMovie();
		$movie->setBackground(
			$background_rgb_array[0],
			$background_rgb_array[0], 
			$background_rgb_array[0]
		);

		$movie->setDimension($width, $height);
		$movie->setRate($fps);

		$video_item = $movie->add($stream);
		$video_item->setname("video1");
		$action_item = $movie->add($action);

		$movie->save($fileName);

	}


}



?>